package cz.zcu.fav.rat.managed.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import cz.zcu.fav.rat.beans.Object;
import cz.zcu.fav.rat.dataaccess.service.ObjectService;
import cz.zcu.fav.rat.managed.locale.LocaleMessageFactory;

@ManagedBean
@RequestScoped
public class ViewObjectBean extends AbstractViewItemBean<Object, ObjectService>
{

	@Override
	protected ObjectService getDataProvider()
	{
		return SpringBeanFactory.getInstance().getBean("objectService",
				ObjectService.class);
	}

	public String getPickStatus()
	{
		return getSelectedItem().getObjectClass().isPickable() ? LocaleMessageFactory
				.getLocale("properties.object.pickaction.yes")
				: LocaleMessageFactory
						.getLocale("properties.object.pickaction.no");

	}
	
	public String getReturnStatus()
	{
		return getSelectedItem().getObjectClass().isReturnable() ? LocaleMessageFactory
				.getLocale("properties.object.returnaction.yes")
				: LocaleMessageFactory
						.getLocale("properties.object.returnaction.no");

	}

}
